---
title: "Secessionism and Wartime Sexual Violence"
author: "Changwook Ju"
date: "`r Sys.Date()`"
output:
  word_document: default
fontsize: 12pt
---

# Preamble and Globals

```{r setup, include=FALSE}

rm(list = ls())

knitr::opts_chunk$set(message = FALSE, warning = FALSE)

options(scipen = 999)

```

# Statamarkdown

```{r}

#install.packages("remotes")

#library(remotes)

#install_github("hemken/Statamarkdown")

library(Statamarkdown)

```

# Descriptive Statistics

```{stata, error = FALSE}

use "data/data.dta", clear

format rebelsv_max statesv_max l_rebelsv_max l_statesv_max secessionistconflict ///
	relrebelstr intervention rebelabductever drugs statepressgangever ///
	lntroopqual terrcontrol leftist frontlineprevbest fcstate gender ///
	exlgender regimetype lngdppc lnpop conflictintst duration %9.2f

sum rebelsv_max statesv_max l_rebelsv_max l_statesv_max secessionistconflict ///
	relrebelstr intervention rebelabductever drugs statepressgangever ///
	lntroopqual terrcontrol leftist frontlineprevbest fcstate gender ///
	exlgender regimetype lngdppc lnpop conflictintst duration, format

```

# Main Analysis (ZIOP)

## Rebel

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit rebelsv_max ///
    secessionistconflict relrebelstr intervention rebelabductever drugs ///
    terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
    conflictintst duration statesv_max, ///
    inflate(secessionistconflict relrebelstr intervention rebelabductever drugs ///
        terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
        conflictintst duration statesv_max) ///
    vce(cluster dyadid) ///
    difficult

parmest, ///
    saving("./results/main_rebel.dta", replace) ///
    level(95 90)

estimates store zioprobit
estimates stats zioprobit

# Predicted Probabilities: 0, 1, 2, 3

margins, ///
    at(secessionistconflict = (0(1)1)) ///
    atmeans

parmest, ///
    saving("./results/main_rebel_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

# Predicted Probabilities: Inflated 0

margins, ///
    predict(pjoint1 outcome(0)) ///
    at(secessionistconflict = (0(1)1)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/main_rebel_inflated0_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

# Predicted Probabilities: True 0

margins, ///
    predict(pnpar) ///
    at(secessionistconflict = (0(1)1)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/main_rebel_true0_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

```

## State

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit statesv_max ///
    secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual fcstate gender regimetype lngdppc lnpop ///
    conflictintst duration rebelsv_max, ///
    inflate(secessionistconflict relrebelstr intervention statepressgangever ///
        lntroopqual fcstate gender regimetype lngdppc lnpop ///
        conflictintst duration rebelsv_max) ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/main_state.dta", replace) ///
    level(95 90)

estimates store zioprobit
estimates stats zioprobit

# Predicted Probabilities: 0, 1, 2, 3

margins, ///
    at(secessionistconflict = (0(1)1)) ///
    atmeans

parmest, ///
    saving("./results/main_state_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

# Predicted Probabilities: Inflated 0

margins, ///
    predict(pjoint1 outcome(0)) ///
    at(secessionistconflict = (0(1)1)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/main_state_inflated0_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

# Predicted Probabilities: True 0

margins, ///
    predict(pnpar) ///
    at(secessionistconflict = (0(1)1)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/main_state_true0_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

```

# Main Analysis (OP)

## Rebel

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

oprobit rebelsv_max ///
    secessionistconflict relrebelstr intervention rebelabductever drugs ///
    terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
    conflictintst duration statesv_max, ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/main_rebel_op.dta", replace) ///
    level(95 90)

estimates store oprobit
estimates stats oprobit

```

## State

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

oprobit statesv_max ///
    secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual fcstate gender regimetype lngdppc lnpop ///
    conflictintst duration rebelsv_max, ///
    vce(cluster dyadid)
	
parmest, ///
    saving("./results/main_state_op.dta", replace) ///
    level(95 90)

estimates store oprobit
estimates stats oprobit

```

# Robustness Check 1

## Rebel

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit rebelsv_max ///
    secessionistconflict relrebelstr intervention rebelabductever drugs ///
    terrcontrol leftist frontlineprevbest exlgender regimetype lngdppc lnpop ///
    conflictintst duration statesv_max, ///
    inflate(secessionistconflict relrebelstr intervention rebelabductever drugs ///
        terrcontrol leftist frontlineprevbest exlgender regimetype lngdppc lnpop ///
        conflictintst duration statesv_max) ///
    vce(cluster dyadid) ///
    difficult

parmest, ///
    saving("./results/rc1_rebel.dta", replace) ///
    level(95 90)

```

## State

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit statesv_max ///
    secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual fcstate exlgender regimetype lngdppc lnpop ///
    conflictintst duration rebelsv_max, ///
    inflate(secessionistconflict relrebelstr intervention statepressgangever ///
        lntroopqual fcstate exlgender regimetype lngdppc lnpop ///
        conflictintst duration rebelsv_max) ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/rc1_state.dta", replace) ///
    level(95 90)

```

# Robustness Check 2

## Rebel

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

# Omit `yrsp1` to ensure model convergence
zioprobit rebelsv_max ///
    secessionistconflict relrebelstr intervention rebelabductever drugs ///
    terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
    conflictintst statesv_max yrsp2 yrsp3, ///
    inflate(secessionistconflict relrebelstr intervention rebelabductever drugs ///
        terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
        conflictintst statesv_max yrsp2 yrsp3) ///
    vce(cluster dyadid) ///
    difficult

parmest, ///
    saving("./results/rc2_rebel.dta", replace) ///
    level(95 90)

```

## State

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit statesv_max ///
    secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual fcstate gender regimetype lngdppc lnpop ///
    conflictintst rebelsv_max i.year, ///
    inflate(secessionistconflict relrebelstr intervention statepressgangever ///
        lntroopqual fcstate gender regimetype lngdppc lnpop ///
        conflictintst rebelsv_max i.year) ///
    vce(cluster dyadid) ///
    difficult

parmest, ///
    saving("./results/rc2_state.dta", replace) ///
    level(95 90)

```

# Robustness Check 3

## Rebel

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit rebelsv_max ///
    secessionistconflict relrebelstr intervention rebelabductever drugs ///
    terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
    conflictintst duration statesv_max l_rebelsv_max, ///
    inflate(secessionistconflict relrebelstr intervention rebelabductever drugs ///
        terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
        conflictintst duration statesv_max l_rebelsv_max) ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/rc3_rebel.dta", replace) ///
    level(95 90)

```

## State

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit statesv_max ///
    secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual fcstate gender regimetype lngdppc lnpop ///
    conflictintst duration rebelsv_max l_statesv_max, ///
    inflate(secessionistconflict relrebelstr intervention statepressgangever ///
        lntroopqual fcstate gender regimetype lngdppc lnpop ///
        conflictintst duration rebelsv_max l_statesv_max) ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/rc3_state.dta", replace) ///
    level(95 90)

```

# Robustness Check 4

## Rebel

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit rebelsv_max ///
    secessionistconflict relrebelstr intervention rebelabductever drugs ///
    terrcontrol leftist i.frontlineprevbest gender lngdppc lnpop ///
    conflictintst duration i.statesv_max, ///
    inflate(secessionistconflict relrebelstr intervention rebelabductever drugs ///
        terrcontrol leftist i.frontlineprevbest gender lngdppc lnpop ///
        conflictintst duration i.statesv_max) ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/rc4_rebel.dta", replace) ///
    level(95 90)

```

## State

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit statesv_max ///
    secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual i.fcstate gender lngdppc lnpop ///
    conflictintst duration i.rebelsv_max, ///
    inflate(secessionistconflict relrebelstr intervention statepressgangever ///
        lntroopqual i.fcstate gender lngdppc lnpop ///
        conflictintst duration i.rebelsv_max) ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/rc4_state.dta", replace) ///
    level(95 90)

```

# Robustness Check 5

## Rebel

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit rebelsv_max ///
    secessionistconflict relrebelstr intervention rebelabductever drugs ///
    terrcontrol leftist frontlineprevbest ///
    conflictintst duration statesv_max, ///
    inflate(secessionistconflict relrebelstr intervention rebelabductever drugs ///
        terrcontrol leftist frontlineprevbest ///
        conflictintst duration statesv_max) ///
    vce(cluster dyadid) ///
    difficult

parmest, ///
    saving("./results/rc5_rebel.dta", replace) ///
    level(95 90)

```

## State

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit statesv_max ///
    secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual fcstate ///
    conflictintst duration rebelsv_max, ///
    inflate(secessionistconflict relrebelstr intervention statepressgangever ///
        lntroopqual fcstate ///
        conflictintst duration rebelsv_max) ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/rc5_state.dta", replace) ///
    level(95 90)

```

# Robustness Check 6

## Rebel

```{stata, error = FALSE}

use "data\data_cs.dta", clear

set cformat %9.2f

# Omit `terrcontrol` to avoid overfitting
zioprobit rebelsv_max ///
    secessionistconflict relrebelstr intervention rebelabductever drugs ///
    leftist frontlineprevbest gender regimetype lngdppc lnpop ///
    conflictintst statesv_max, ///
    inflate(secessionistconflict relrebelstr intervention rebelabductever drugs ///
        leftist frontlineprevbest gender regimetype lngdppc lnpop ///
        conflictintst statesv_max) ///
    vce(cluster conflictid)

parmest, ///
    saving("./results/rc6_rebel.dta", replace) ///
    level(95 90)

```

## State

```{stata, error = FALSE}

use "data\data_cs.dta", clear

set cformat %9.2f

# Omit `statepressgangever` and `rebelsv_max` to ensure model convergence
zioprobit statesv_max ///
    secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual fcstate gender regimetype lngdppc lnpop ///
    conflictintst rebelsv_max, ///
    inflate(secessionistconflict relrebelstr intervention ///
        lntroopqual fcstate gender regimetype lngdppc lnpop ///
        conflictintst) ///
    vce(cluster conflictid)

parmest, ///
    saving("./results/rc6_state.dta", replace) ///
    level(95 90)

```

# Longitudinal Analysis

## Rebel

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit rebelsv_max ///
    secessionistconflict_duration ///
	secessionistconflict relrebelstr intervention rebelabductever drugs ///
    terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
    conflictintst duration statesv_max, ///
    inflate(secessionistconflict_duration ///
		secessionistconflict relrebelstr intervention rebelabductever drugs ///
        terrcontrol leftist frontlineprevbest gender regimetype lngdppc lnpop ///
        conflictintst duration statesv_max) ///
    vce(cluster dyadid) ///
    difficult

parmest, ///
    saving("./results/longitudinal_rebel.dta", replace) ///
    level(95 90)

# Predicted Probabilities: 0, 1, 2, 3

margins, ///
    at(secessionistconflict_duration = (0(1)47)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/longitudinal_rebel_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

# Predicted Probabilities: Inflated 0

margins, ///
    predict(pjoint1 outcome(0)) ///
    at(secessionistconflict_duration = (0(1)47)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/longitudinal_rebel_inflated0_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

# Predicted Probabilities: True 0

margins, ///
    predict(pnpar) ///
    at(secessionistconflict_duration = (0(1)47)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/longitudinal_rebel_true0_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

```

## State

```{stata, error = FALSE}

use "data\data.dta", clear

set cformat %9.2f

zioprobit statesv_max ///
    secessionistconflict_duration ///
	secessionistconflict relrebelstr intervention statepressgangever ///
    lntroopqual fcstate gender regimetype lngdppc lnpop ///
    conflictintst duration rebelsv_max, ///
    inflate(secessionistconflict_duration ///
		secessionistconflict relrebelstr intervention statepressgangever ///
        lntroopqual fcstate gender regimetype lngdppc lnpop ///
        conflictintst duration rebelsv_max) ///
    vce(cluster dyadid)

parmest, ///
    saving("./results/longitudinal_state.dta", replace) ///
    level(95 90)

# Predicted Probabilities: 0, 1, 2, 3

margins, ///
    at(secessionistconflict_duration = (0(1)47)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/longitudinal_state_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

# Predicted Probabilities: Inflated 0

margins, ///
    predict(pjoint1 outcome(0)) ///
    at(secessionistconflict_duration = (0(1)47)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/longitudinal_state_inflated0_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

# Predicted Probabilities: True 0

margins, ///
    predict(pnpar) ///
    at(secessionistconflict_duration = (0(1)47)) ///
    atmeans ///
    noatlegend

parmest, ///
    saving("./results/longitudinal_state_true0_pp.dta", replace) ///
    level(95 90) ///
    bmat(r(b)) ///
    vmat(r(V))

```
